package com.zifeng.exception;

public class BizException extends RuntimeException {

    private final int code;

    public BizException(ErrorEnum errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }

    public BizException(ErrorEnum errorCode, Object... args) {
        super(errorCode.formatMessage(args));
        this.code = errorCode.getCode();
    }

    public int getCode() {
        return code;
    }
}
